cmake_minimum_required(VERSION 3.10.2)
project(lib)
# find_package(Threads)
set(CMAKE_CXX_STANDARD 17) 
add_definitions("-Wall -g")
add_compile_options(-fPIC)
set(CMAKE_C_FLAGS"$ {CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS"$ {CMAKE_CXX_FLAGS} -fPIC")

set(BOOST_ROOT /usr/local/include/boost)
find_package(Boost COMPONENTS filesystem REQUIRED)

#向当前工程添加存放源文件的子目录
# add_subdirectory (./src)
# aux_source_directory (. SRC_LIST)

add_library(fib SHARED ./src/Fibonacci.cpp)
set_target_properties (fib PROPERTIES OUTPUT_NAME "fibFunc")
target_link_libraries(fib lua ${Boost_LIBRARIES} )

add_library(pri SHARED ./src/print.cpp)
set_target_properties (pri PROPERTIES OUTPUT_NAME "priFunc")
target_link_libraries(pri lua ${Boost_LIBRARIES} )

add_library(show SHARED ./src/show.cpp)
set_target_properties (show PROPERTIES OUTPUT_NAME "showFunc")
target_link_libraries(show lua ${Boost_LIBRARIES} ) 

set (LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR})




# # 使用${SRC_LIST}为原材料生成一个叫做testFunc_shared 的动态库
# add_library (testFunc_shared SHARED ${SRC_LIST})
# # 使用${SRC_LIST}为原材料生成一个叫做testFunc_static 的静态库
# add_library (testFunc_static STATIC ${SRC_LIST})

# # 将testFunc_shared 重新命名为 libtestFunc.so
# set_target_properties (testFunc_shared PROPERTIES OUTPUT_NAME "testFunc")
# # 将testFunc_static  重新命名为 libtestFunc.a
# set_target_properties (testFunc_static PROPERTIES OUTPUT_NAME "testFunc")

# 设置 库文件的默认输出路径
# set (LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
